package com.wd.pub.tools.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * @Author: He Zhigang
 * @Date: 2019/5/30 17:16
 * @Description:
 */

@Configuration
public class DataSourceConfig {

    @Bean(name = "spisDataSource")
    @Qualifier("spisDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.spischolar")
    public DataSource storyDataSource() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "uoServerDataSource")
    @Qualifier("uoServerDataSource")
    @Primary
    @ConfigurationProperties(prefix = "spring.datasource.uo-server")
    public DataSource activityDataSource() {
        return DataSourceBuilder.create().build();
    }
}
